<!--<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>
<!--<link rel="stylesheet"
	href="<c:url value="/statics/bootstrap-3.3.0/css/bootstrap.css"/>">-->
<link rel="stylesheet"
	  href="../statics/bootstrap-3.3.0/css/bootstrap.css">
<!--<link rel="stylesheet" href="<c:url value="/statics/css/style.css"/>">-->
<link rel="stylesheet" href="../statics/css/style.css">
</head>
<!--<body
		style="background-image: url(<c:url value="/statics/image/background/background2.jpg"/>); background-size: cover">-->
<body background="../statics/image/background/background2.jpg" style=" background-repeat:no-repeat ; background-size:100% 100%; background-attachment: fixed;" >
	<div style="margin: 20px auto">
		<div style="margin: 100px auto; margin-bottom: 40px" align="center">
			<h1 style="font-size: 60px; color: #ffffff">管理员登录</h1>
		</div>
	</div>

	<div class="container" style="position: relative; margin: 80px auto;">
		<div class="col-md-6 login-back"
			style="position: absolute; left: 50%; transform: translateX(-50%);">
			<!--	<form action="<c:url value="/admin/adminLogin"/>" method="post">-->
<!--			<form action="/admin/adminLogin" method="post">-->
				<div class="form-group">
					<label for="email">邮箱</label> <input class="form-control"
						id="email" name="email" type="email" />
				</div>

				<div class="form-group">
					<label for="password">密码</label> <input class="form-control"
						id="password" name="password" type="password" />
				</div>

				<div>
			<!--	<output style="color: red">${message}</output>-->
					<output id="loginError" style="color: red"></output>
				</div>

				<button id="login" style="width: 100%" type="submit" class="btn btn-primary">登录</button>
<!--			</form>-->
			<!--<a href="<c:url value="/login"/>">用户登录</a>-->
			<a href="/home/login.html">用户登录</a>
		</div>
	</div>
	<!--<script src="<c:url value="/statics/jquery-1.12.4/jquery-1.12.4.js"/>"></script>
	<script src="<c:url value="/statics/bootstrap-3.3.0/js/bootstrap.js"/>"></script>-->
	<script src="../statics/jquery-1.12.4/jquery-1.12.4.js"></script>
	<script src="../statics/bootstrap-3.3.0/js/bootstrap.js"></script>
</body>
<script>
	$(function (){
		// 用户登录
		$('#login').click(function (){
			var email = document.getElementById("email").value;
			var password = document.getElementById("password").value;
			var info = {
				"email":email,
				"password":password
			};
			$.ajax({
				async : false,
				url : "/admin/login",
				type : 'POST',
				contentType : 'application/x-www-form-urlencoded',
				dataType : 'json',
				data : info,
				success : function (data) {
					if (data.code === 20000) {
						window.location.href = "/admin/adminPage.html";
					} else {
						$("#loginError").val("密码错误")
					}
				},
				error: function (xhr, textStatus) {
					console.log(xhr);
					console.log(textStatus)
				}
			});
		})
	})
</script>
</html>